var basePath = "/";
var opts = artDialog.data("params");
var cateId = $("#cateId").val();
var warInfoHandle = new ListHandle({
  basePath: basePath,
  tableId: '#grid-table',
  pagerId: '#grid-pager',
  formId: '#queryForm',
  entityName: '作战图',
  winWidth: '500px',
  winHeight: '400px',
  primaryKey: 'id',
  urls:{
    list: basePath+'warInfo/list?cateId='+cateId,
    deleted: basePath+'warInfo/deleted',
  }
},{
  view: function(id){
    opts.viewMarker(id);
    art.dialog.close();
  }
});
$(function(){
  var fields = [];
  var ff = $("#fields").val();
  if(ff){
    ff = ff.replace(/,/g, "','").replace(/\s*/g, "").replace("[", "['").replace("]", "']");
    fields = eval(ff);
  }
  var colNames = ['操作', 'id', '经度', '纬度'];
  var colModel = [
    {align: "center", editable: false, sortable: false, width: 50, formatter: function(cellvalue, options, rowObject){
      var temp = '';
      temp += '<a class="linetaga" href="javascript: warInfoHandle.view(\'' + rowObject.id + '\');" >查看</a>';
      return temp;
    }},
    {name: 'id', index: 'id', width: 50, align: "center", formatter: function(cellvalue, options, rowObject){
      return cellvalue.toFixed(0);
    }}, 
    {name: 'lng', index: 'lng', editable: false, sortable: false, width: 50, align: "center"}, 
    {name: 'lat', index: 'lat', editable: false, sortable: false, width: 50, align: "center"}
  ];
  fields.forEach(function(field){
    colNames.push(field);
    colModel.push({name: field, editable: false, sortable: false, width: 55, align: "center"});
  });
  var rowList = [10, 25, 35, 55];
  var rownumbers = true;
  var multiselect = true;
  var config={rowNum: 25, dataType: "local", height:"650px", caption: "图层数据列表", colNames: colNames, colModel: colModel, rowList: rowList, rownumbers: rownumbers, multiselect: multiselect};
  setTimeout(function(){
    warInfoHandle.init(config);
    warInfoHandle.query();
  }, 300);
});